package web3.DaoDemo;

import org.springframework.jdbc.core.JdbcTemplate;
import web3.Jdbcutils.Jdbcutils;
import web3.user.user1;

public class daoDemo1 {
    public Integer login(user1 user1) {
//创建一个jdbctemplate 对象
        JdbcTemplate jdbcTemplate = new JdbcTemplate(Jdbcutils.getDataSource());
        //编写sql语句
        String sql="select count(*) from user where username=? and password=?";
        //调用方法
        Integer count = jdbcTemplate.queryForObject(sql, int.class , user1.getUsername(), user1.getPassword());
        return count;
    }
}
